package com.demo.oauth2jFinalShiroClient.oAuth2;

import org.apache.shiro.authc.AuthenticationToken;

public class ThirdPartToken implements AuthenticationToken {

	private String accessToken;
	private ThirdPartUser thirdPartUser;

	public ThirdPartToken(ThirdPartUser thirdPartUser, String accessToken) {
		super();
		this.thirdPartUser = thirdPartUser;
		this.accessToken = accessToken;
	}

	public String getUsername() {
		return thirdPartUser.getChannel()+"_"+thirdPartUser.getUsername();
	}

	public String getAccessToken() {
		return accessToken;
	}

	public String getChannel() {
		return thirdPartUser.getChannel();
	}

	@Override
	public Object getPrincipal() {
		return thirdPartUser;
	}

	@Override
	public Object getCredentials() {
		return accessToken;
	}

}
